/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Competente;





import adsreis.com.Beans.ClientesBean;
import adsreis.com.Beans.CondsBean;
import adsreis.com.Beans.FormasBean;
import adsreis.com.Beans.FuncionariosBean;
import adsreis.com.Beans.OSBean;
import adsreis.com.Beans.OSdetBean;
import adsreis.com.Beans.OrcamentosBean;
import adsreis.com.Beans.OrcamentosdetBean;

import adsreis.com.Beans.ProdutosBean;
import adsreis.com.Beans.StatusOrcamentoBean;
import adsreis.com.Controls.ClientesControl;
import adsreis.com.Controls.CondsControl;
import adsreis.com.Controls.FormasControl;
import adsreis.com.Controls.OSControl;
import adsreis.com.Controls.OSdetControl;
import adsreis.com.Controls.OrcamentosControl;
import adsreis.com.Controls.OrcamentosdetControl;
import adsreis.com.Controls.ProdutosControl;
import adsreis.com.Controls.StatusOrcamentoControl;
import adsreis.com.Controls.VerificarData;
import adsreis.com.acessobd.AcessoMySql;
import java.awt.AWTKeyStroke;
import java.awt.Color;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.sql.Connection;
import java.sql.Date;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author Pauroenriki
 */
public class Orcamentos extends javax.swing.JFrame {
    DefaultTableModel tmItens = new DefaultTableModel(null, new String []{"Codigo", "Descrição", "Marca", "Valor", "Quatidade"});
    DefaultTableModel tmOrcamentosPendentes = new DefaultTableModel(null, new String[] {"Codigo", "Status", "Cliente","Vendedor", "Data do Orçamento", "Data de Validade", "Forma Pgto", "Cond. Pgto"});
    
    ListSelectionModel lsmOrcamentosPendentes;
    
    
    
    DefaultTableModel tmOrcamentos = new DefaultTableModel (null, new String[] {"Codigo", "Produto", "Unit","Quantidade", "Montante"});
    //ListSelectionModel lsmFuncionarios;
    List<FuncionariosBean> funcionarios;
    List<ProdutosBean> produtos;
    List<ClientesBean> clientes;
    List<FormasBean> formas;
    List<CondsBean> conds;
    List<StatusOrcamentoBean> statusOrc;
    List<OrcamentosBean> orcamentos = new ArrayList<>();
    public static List<OrcamentosBean> orcamentospendentes = new ArrayList<>();
    List<OrcamentosdetBean> itensOrcamentos = new ArrayList<>();
    List<OrcamentosdetBean>orcamentosdet = new ArrayList<>();
    List<ProdutosBean> produt = new ArrayList<>();
    ListSelectionModel lsmOrcamentos;
    String codprod;
    String busca;
    String codprod1;
    String quantidade;
    String unit;
    Integer codorcamento;
    Integer codstatus;
    String Nproduto;
    String valor;
    Integer remover;
    Integer qtdestoque;
    String verificaduplicidade = "";
    Integer qtd;
    String codproduto;
    String User;
    Integer Funcionariologado;
    Funcionarios FrameFuncionarios;
    double subtotal = 0;
    double desconto = 0;
    double total = 0;
    double servicoterceiro = 0;
    double mo = 0;
    Date verificardata;
    
    Date dat;
    String codp;
    String fun;
    String cli;
    String form;
    String cond;
    Integer Acesso;
    
    
    
    
    
    
    
    protected void listarClientes(){
        ClientesControl cli = new ClientesControl();
        clientes = cli.listarClientes("%%");
        cbClientes.removeAllItems();
        for (int i = 0; i < clientes.size(); i++){
            cbClientes.addItem(clientes.get(i).getNome());
        }
    }
    
    protected void listarStatus(){
        StatusOrcamentoControl status = new StatusOrcamentoControl();
        statusOrc = status.listarStatus("%%");
        cbStatus.removeAllItems();
        for (int i = 0; i < statusOrc.size(); i++){
            cbStatus.addItem(statusOrc.get(i).getStatus());
            
        }
    }
    
    
    
    protected void listarFormas(){
        FormasControl func = new FormasControl();
        formas = func.listarFormas("%%");
        cbFormas.removeAllItems();
        for (int i = 0; i < formas.size(); i++){
            cbFormas.addItem(formas.get(i).getForma());
        }
    }
    
    protected void listarConds(){
        CondsControl func = new CondsControl();
        conds = func.listarConds("%%");
        cbConds.removeAllItems();
        for (int i = 0; i < conds.size(); i++){
            cbConds.addItem(conds.get(i).getCond());
        }
    }
   
    /*private void listcliente(){
        String cl;
        cl = tfClientes.getText();
        ClientesControl cli = new ClientesControl();
        List<ClientesBean> cc;
        cc = cli.listarClientes("%" + cl + "%");
        ClientesBean cb = new ClientesBean();
        //cbClientes.removeAllItems();
        for (int i = 0; i < cc.size(); i++){
            //cbClientes.addItem(clientes.get(i).getNome());
             cb.setCodCliente(cc.get(i).getCodCliente());
             cb.setNome(cc.get(i).getNome());
             cb.setPlaca(cc.get(i).getPlaca());
        }
    
        tfClientes.setText(cb.getNome());
        
    }*/
    
    
    
    /**
     * Creates new form Vendas
     */
    protected Orcamentos() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException{
        initComponents();
        listarClientes();
        listarStatus();
        
        listarFormas();
        listarConds();
        ftfQuantidade.setValue(1);
        setIcon();
        Login ff = new Login();
        Acesso = ff.nAcesso;
        User = ff.acessivel;
        Funcionariologado = ff.idfunc;
        this.setTitle("CADASTRAR ORÇAMENTOS - Usuário: " + User);
        Nacesso();
        
        
        // Colocando enter para pular de campo 
HashSet conj = new HashSet(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS)); 
conj.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
conj.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, conj); 

        
        
    }
    
    private void setIcon() {
        //etIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("a.png")));﻿
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Icons/icon.png")));
    }
    
    
    private void Nacesso(){
        
        switch (Acesso){
            case 0:
               
                btExcluir.setVisible(false);
                btExcluirVenda.setVisible(false);
                btReprovar.setVisible(false);
            case 1:
                btExcluir.setVisible(false);
                btExcluirVenda.setVisible(false);
                btReprovar.setVisible(false);
        }
        
        
    }
    
    
    
    protected void novoCadastro(){
        OrcamentosControl vc = new OrcamentosControl();
     codorcamento = vc.buscarCodigoUltimOrcamento()+ 1;
     habilitarCampos();
     btNovo.setEnabled(false);
     lblCodigo.setText(String.valueOf(codorcamento));
     OrcamentosBean ob = new OrcamentosBean();
     
     
            
            ob.setCodOrcamento(codorcamento);
            orcamentos.add(ob);
     
     
     
     
     
     
     while (tmOrcamentos.getRowCount()>0){
            tmOrcamentos.removeRow(0);            
        }
     ftfQuantidade.setValue(null);
     SimpleDateFormat formato = new SimpleDateFormat("dd / MM / yyyy");
     java.util.Date d = new java.util.Date();
     String dd;
     dd = String.valueOf(formato.format(d));
     
     lblData.setText(dd);
     ftfDataVencimento.setDate(d);
     ftfSubtotal.setValue(0);
     ftfDesconto.setValue(0);
     ftfTotal.setValue(0);
     ftfMO.setValue(0);
     ftfServicoTerceiros.setValue(0);
     ftfQuantidade.setValue(1);
     tfProduto.requestFocus();
            
    }
    
    
    protected void habilitarCampos(){
     cbClientes.setEnabled(true);
    
     //cbFuncionarios.setEnabled(true);
     cbFormas.setEnabled(true);
     cbConds.setEnabled(true);
     ftfQuantidade.setEnabled(true);
     ftfDesconto.setEnabled(true);
     ftfTotal.setEnabled(true);
     ftfSubtotal.setEnabled(true);
     btFinalizar.setEnabled(true);
     btInserir.setEnabled(true);
     cbStatus.setEnabled(true);
     ftfDataVencimento.setEnabled(true);
     ftfServicoTerceiros.setEnabled(true);
     tfObs.setEnabled(true);
     ftfMO.setEnabled(true);
     tfProduto.setEnabled(true);
    }
    
    
    protected void desabilitarCampos(){
     cbClientes.setEnabled(false);
     //cbFuncionarios.setEnabled(false);
     cbFormas.setEnabled(false);
     cbConds.setEnabled(false);
     btFinalizar.setEnabled(false);
     ftfQuantidade.setEnabled(false);
     ftfDesconto.setEnabled(false);
     ftfTotal.setEnabled(false);
     ftfSubtotal.setEnabled(false);
     cbStatus.setEnabled(false);
     ftfDataVencimento.setEnabled(false);
     ftfServicoTerceiros.setEnabled(false);
     tfObs.setEnabled(false);
     ftfMO.setEnabled(false);
     tfProduto.setEnabled(false);
     btcomprovante.setEnabled(false);
     
     
     ftfQuantidade.setText(null);
     ftfDesconto.setText(null);
     ftfTotal.setText(null);
     ftfSubtotal.setText(null);
     tfProduto.setText("");
     
     
     
    }
    
    public void excluirOrcamento(){
        if (tbOrcamentosPendentes.getSelectedRow() != -1){
            int resposta = JOptionPane.showConfirmDialog(this, "Tem certeza que quer excluir o orçamento selecionado?", "Confirmação",
                    JOptionPane.YES_NO_OPTION);
            if (resposta == JOptionPane.YES_OPTION){
                OrcamentosControl vc = new OrcamentosControl();
                vc.excluirOrcamento(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getCodOrcamento());
                ProdutosControl pc = new ProdutosControl();
                ProdutosBean pb = new ProdutosBean();
                for(int i=0; i<itensOrcamentos.size(); i++){
                    pb.setCodProduto(itensOrcamentos.get(i).getIDProduto());
                    pb.setQtdEstoque(itensOrcamentos.get(i).getQtdOrcamento());
                pc.incluirQtdEstoque(pb);
                }
                //btAlterar.setEnabled(false);
                btExcluirVenda.setEnabled(false);
                pesquisarOrcamentos();
            }
        }
    }
    
    public void excluirOrcamentoDet(){
        if (tbOrcamentosPendentes.getSelectedRow() != -1){
         
                OrcamentosdetControl vc = new OrcamentosdetControl();
                vc.excluirOrcamentoDET(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getCodOrcamento());
                ProdutosControl pc = new ProdutosControl();
                
               
                //btAlterar.setEnabled(false);
                btExcluirVenda.setEnabled(false);
            
        }
    }
    
    protected void cadastrarOrcamento(){
     tbOrcamentosPendentes.getSelectionModel().clearSelection();
        if(orcamentosdet.size() == 0){
            JOptionPane.showMessageDialog(this, "Inclua ao menos um produto!");
        } else {
            try{
            OrcamentosControl oc = new OrcamentosControl();
            SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd");
            java.util.Date d = new java.util.Date();
            Date data = Date.valueOf(formato.format(d));
            
            
            OrcamentosBean ob = new OrcamentosBean();
            
            
            
            java.util.Date datav;
            datav = ftfDataVencimento.getDate();
            Date datavali = Date.valueOf(formato.format(datav));
            
            
            for (int i = 0; i < orcamentos.size(); i++){
                
                orcamentos.get(i).setIDCliente(clientes.get(cbClientes.getSelectedIndex()).getCodCliente());
                orcamentos.get(i).setIDStatus(statusOrc.get(cbStatus.getSelectedIndex()).getCodstatus());
                //vendas.get(i).setIDFuncionario(funcionarios.get(cbFuncionarios.getSelectedIndex()).getCodFuncionario());
                orcamentos.get(i).setIDFuncionario(Funcionariologado);
                orcamentos.get(i).setIDForma(formas.get(cbFormas.getSelectedIndex()).getCodForma());
                orcamentos.get(i).setIDCond(conds.get(cbConds.getSelectedIndex()).getCodCond());
                orcamentos.get(i).setDataOrcamento(data);
                orcamentos.get(i).setDataValidade(datavali);
                orcamentos.get(i).setCodOrcamento(codorcamento);
                orcamentos.get(i).setSubTotal(subtotal);
                orcamentos.get(i).setServicoTerceiro(servicoterceiro);
                orcamentos.get(i).setMaoObra(mo);
                orcamentos.get(i).setDesconto(desconto);
                orcamentos.get(i).setTotal(total);
                orcamentos.get(i).setObs(tfObs.getText());
                oc.cadastrarOrcamento(orcamentos.get(i));
                
            }
            
            
            for (int i = 0; i < orcamentosdet.size(); i++){
                orcamentosdet.get(i).getIDOrcamento(); 
                orcamentosdet.get(i).getIDProduto();
                orcamentosdet.get(i).getQtdOrcamento();
                orcamentosdet.get(i).getPreco();
                oc.cadastrarItem(orcamentosdet.get(i));
                System.out.println(orcamentosdet.get(i).getIDProduto());
                
            }
            
                    
            /*for (int t = 0; t < produt.size();t++){ //Removendo Itens do estoque
            produt.get(t);
            ProdutosControl pb = new ProdutosControl();
            pb.retirarQtdEstoque(produt.get(t));
                }*/
            
            
            
            JOptionPane.showMessageDialog(this, "Orçamento cadastrado com Sucesso!");
            desabilitarCampos();
             btNovo.setEnabled(true);
             fechar();
             
            } catch(Exception ex){
                JOptionPane.showMessageDialog(this, "Erro ao cadastrar Orçamento!");
                //fechar();
                
            }

            
        }
      
    }

    
    protected boolean verificarDuplicidade(){
        
        for(int i = 0; i<orcamentosdet.size(); i++){//produt
               
               verificaduplicidade = orcamentosdet.get(i).getIDProduto();
               
        
               if(verificaduplicidade.equals(codprod)){ //verificaduplicidade == null ? codprod != null : 
                 JOptionPane.showMessageDialog(this, "Item em duplicidade!");
                   return false;
                 
               }
        }
            
               
        return true;
        
    }
    
    
    private String buscaprod(String prod){
        ProdutosBean pb = new ProdutosBean();
        OrcamentosControl oc = new OrcamentosControl();
        oc.listarProdutos(prod);
        
        
        produtos = OrcamentosControl.produtos1;
        for (int i =0; i < produtos.size(); i++){
          pb.setCodProduto(produtos.get(i).getCodProduto());
       }
        
        
        codprod = pb.getCodProduto();
        
        
        return codprod;
    }
    
    
    
    
    
    protected void incluirProduto(){
        
        //while (produtos.size()>0){
          //  produtos.remove(0);            
        //}
        
        ProdutosBean produto = new ProdutosBean();
        
        
            //produto.setCodProduto(tfProduto.getText());
            //codprod = produto.getCodProduto();
           busca = tfProduto.getText();
               OrcamentosControl oc = new OrcamentosControl();
            buscaprod(busca);
            try {
            if (codprod == null) {
                JOptionPane.showMessageDialog(this, "Produto não cadastrado!");
                
            }else if (verificarQuantidade() && verificarQuantidadeEstoque() && verificarDuplicidade()){
            OrcamentosdetBean vb = new OrcamentosdetBean();
            vb.setIDOrcamento(codorcamento);
            vb.setIDProduto(codprod);
            vb.setQtdOrcamento(Integer.parseInt(String.valueOf(ftfQuantidade.getValue())));
            //buscaprod(busca);              //¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
            //oc.listarProdutos(codprod);   *********************************
            produtos = OrcamentosControl.produtos1;
            
            for (int i =0; i < produtos.size(); i++){
           produto.setCodProduto(produtos.get(i).getCodProduto());
           produto.setDescricao(produtos.get(i).getDescricao());
           produto.setMarca(produtos.get(i).getMarca());
           produto.setVlrVenda(produtos.get(i).getVlrVenda());
           
       }
            
            
            
            
            produto.setQtdEstoque(Integer.parseInt(String.valueOf(ftfQuantidade.getValue())));
            produt.add(produto);
            orcamentosdet.add(vb);
            
            
            
            unit = String.valueOf(produto.getVlrVenda());
            Nproduto = produto.getDescricao();
            quantidade = String.valueOf(ftfQuantidade.getValue());
            codprod1 = String.valueOf(codprod);
            valor = String.valueOf(produto.getVlrVenda() * Integer.parseInt(quantidade));
            String [] campos = new String [] { codprod1, Nproduto, unit, quantidade, valor};
            tmOrcamentos.addRow(campos);
            
            ftfTotal.setValue(0);
            ftfDesconto.setValue(0);
            subtotal += Double.parseDouble(valor);    
            ftfSubtotal.setValue(subtotal);
            
            
        
            
            
            
            
            
            
            
        }
        
        
        else {
            ftfQuantidade.requestFocus();
        }
        
        
        } catch(Exception ex){
            
           // JOptionPane.showMessageDialog(this, "Digite corretamente o CÓDIGO ou DESCRIÇÃO do Produto", "ERRO", JOptionPane.ERROR_MESSAGE);  
                tfProduto.requestFocus();
        }
        
        
            
            while (oc.produtos1.size()>0){
            oc.produtos1.remove(0);
            
            }
            while (produtos.size()>0){
            produtos.remove(0);
            
            }
    
    }
    
    protected boolean verificarQuantidadeEstoque(){               //verifica se a quantidade pedida pelo usuário, tem saldo positivo no estoque
        //try{
            ProdutosControl pc = new ProdutosControl();
            
            
            ProdutosBean p = pc.buscarQtd(codprod);         //Verificando o Banco de dados
            qtdestoque = p.getQtdEstoque();
            Integer qtcom;
            qtcom = Integer.parseInt(ftfQuantidade.getText().trim());
            
            
            
            
            if (qtdestoque >= qtcom && qtdestoque > 0){
                return true;
            }else{
       // }catch (NumberFormatException ex){
        //    ex.getMessage();
            JOptionPane.showMessageDialog(this, "O Produto selecionado está em falta!" + "\n Veja a quantidade em estoque: " + qtdestoque);
        }
        return false;
    }
    
    
    
    protected boolean verificarQuantidade(){ //verifica se o usuario inseriu quantidade valida antes de inserir o produto na tabela
       
        try{
            if (Integer.parseInt(String.valueOf(ftfQuantidade.getValue())) > 0){
                return true;
            }
        }catch (NumberFormatException ex){
            //ex.printStackTrace();
            JOptionPane.showMessageDialog(this, "Quantidade inválida!");
        }
        return false; 
        
    }
    
    protected void removerProduto(){
        if (tbOrcamentos.getSelectedRow() != -1){               //exclui produto selecionado
            int resposta = JOptionPane.showConfirmDialog(this, "Tem certeza que quer excluir o produto selecionado?", "Confirmação",
                    JOptionPane.YES_NO_OPTION);
            if (resposta == JOptionPane.YES_OPTION){
                remover = tbOrcamentos.getSelectedRow();
                orcamentosdet.remove(tbOrcamentos.getSelectedRow());
                produt.remove(tbOrcamentos.getSelectedRow());
                tmOrcamentos.removeRow(tbOrcamentos.getSelectedRow());
                
                
                btExcluir.setEnabled(false);
            ftfQuantidade.setValue(null);
        
    }
    }else{
        JOptionPane.showMessageDialog(this, "Nenhum item selecionado!");
        }
    }
    
    
    
    
    protected void tbVendasLinhaSelecionada(JTable tb){             //Ao selecionar um item na tabela, os dados serão preenchidos nos campos
        if (tb.getSelectedRow() != -1){
            btExcluir.setEnabled(true);
            //lblCodigo.setText(String.valueOf(produtos.get(tb.getSelectedRow()).getCodProduto()));
            //cbClientes.setSelectedIndex(tbVendas.getSelectedRow());
            //cbProdutos.setSelectedIndex(tbOrcamentos.getSelectedRow());
            //cbFuncionarios.setSelectedIndex(tbVendas.getSelectedRow());
            //tfQtd.setInt(String.valueOf(tbVendas.getSelectedRow())).getQtd();
            //ftfQuantidade.setText(String.valueOf(orcamentos.get(tbOrcamentos.getSelectedRow()).getQtd()));
            
            
        } else {
            
        }
    }
    
    protected void pesquisarOrcamentos(){
         ClientesBean cb = new ClientesBean();
        OrcamentosControl vc = new OrcamentosControl();
        //if (ftfDataInicio.getValue() == null){
        if (dataIni.getDate()== null){
            JOptionPane.showMessageDialog(this, "Informe a data Inicial!");
            dataIni.requestFocus();
        //} else if (ftfDataFim.getValue() == null){
            } else if (dataFim.getDate() == null){
            JOptionPane.showMessageDialog(this, "Informe a data Final!");
            dataFim.requestFocus();
        } else {
            while (tmOrcamentosPendentes.getRowCount() > 0){
                tmOrcamentosPendentes.removeRow(0);
               
            }
            while (orcamentospendentes.size()>0){
            orcamentospendentes.remove(0);            
        }
            SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd");
            //java.util.Date dataInicio = (java.util.Date) ftfDataInicio.getValue();
            java.util.Date dataInicio = (java.util.Date) dataIni.getDate();
            System.out.println(formato.format(dataInicio));
            //java.util.Date dataFim = (java.util.Date) ftfDataFim.getValue();
            java.util.Date dataFinal = (java.util.Date) dataFim.getDate();
            orcamentospendentes = vc.listarOrcamentos(Date.valueOf(formato.format(dataInicio)), Date.valueOf(formato.format(dataFinal)));
            
           // verificardata = orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getDataValidade();
            //String d1;
            
            //d1 = String.valueOf(dateControl1.getDate());
           // System.out.println(d1);
            
            
            String [] campos = new String[] {null, null, null, null, null, null, null, null};
            
             for (int i = 0; i < orcamentospendentes.size(); i++){ 
            //for (int i = 0; i < orcamentospendentes.size(); ++i){    
                //Carregando tabela de vendas finalizadas
                //String [] campos = new String[] {codp, cli, null, null, null, null};
                //codp = String.valueOf(vendasfinalizadas.get(i).getCodVenda());
                //cli = String.valueOf(vendasfinalizadas.get(i)clientes.getNome());
                
                
                
                tmOrcamentosPendentes.addRow(campos);
                
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getCodOrcamento(), i, 0);
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getStatusOrcamento(), i, 1);
                //tmVendasFinalizadas.setValueAt(vendasfinalizadas.get(i).getIDCliente(), i, 1);
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getNomeCli(), i, 2);
                //tmVendasFinalizadas.setValueAt(vendasfinalizadas.get(i).getIDFuncionario(), i, 3);
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getNomeFunc(), i, 3);
                Date ddd;
                
                ddd = orcamentospendentes.get(i).getDataOrcamento();
                SimpleDateFormat formato2 = new SimpleDateFormat("dd / MM / yyyy");
                 java.util.Date d = ddd;
                String dd;
                dd = String.valueOf(formato2.format(d));
            
               tmOrcamentosPendentes.setValueAt(dd, i, 4);
               Date dv;
                String ddv;
               dv = orcamentospendentes.get(i).getDataValidade();
               ddv = String.valueOf(formato2.format(dv));
               tmOrcamentosPendentes.setValueAt(ddv, i, 5);
                
                //tmVendasFinalizadas.setValueAt(vendasfinalizadas.get(i).getIDForma(), i, 6);
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getFormapgto(), i, 6);
                //tmVendasFinalizadas.setValueAt(vendasfinalizadas.get(i).getIDCond(), i, 8);
                tmOrcamentosPendentes.setValueAt(orcamentospendentes.get(i).getCondpgto(), i, 7);
                
                
                
                
            
               }
            
            if (orcamentospendentes.size() == 0){
                JOptionPane.showMessageDialog(this, "Nenhum registro encontrado!");
            
        }
    }
    }
    
    //@SuppressWarnings("empty-statement")
    
    
   /* public void verificarData(){
        Date compararvencimento = new Date(System.currentTimeMillis());
        verificardata = orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getDataValidade();
        if(verificardata.before(compararvencimento)){
            lblDtVencimento.setForeground(Color.red);
        }else{
        
        lblDtVencimento.setForeground(Color.black);
        }
     //verificardata = null;   
    } */
    
    
    
    
    private void criarOS(){
        
        Date ddd = new Date(System.currentTimeMillis());
     
        
        OSBean osb = new OSBean();
        OSControl osc = new OSControl();
        OSdetBean odb = new OSdetBean();
        OSdetControl odc = new OSdetControl();
        Integer codos;
        
        codos = osc.buscarCodigoUltimaOS() + 1;
        osb.setCodOs(codos);
        osb.setIDStatus(1);
        osb.setIDFuncionario(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getIDFuncionario());
        osb.setIDCliente(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getIDCliente());
        osb.setIDForma(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getIDForma());
        osb.setIDCond(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getIDCond());
        osb.setDataos(ddd);
        osb.setSubTotal(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getSubTotal());
        osb.setServicoTerceiro(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getServicoTerceiro());
        osb.setMaoObra(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getMaoObra());
        osb.setDesconto(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getDesconto());
        osb.setTotal(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getTotal());
        osb.setValorPago(0.00);
        osb.setResta(0.00);
        osb.setObs(orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getObs());
        osc.cadastrarOS(osb);
        ProdutosBean pb = new ProdutosBean();
            ProdutosControl pc = new ProdutosControl();
        
       for (int i = 0; i < itensOrcamentos.size(); i++){
                odb.setIDOs(codos);
                odb.setIdproduto(itensOrcamentos.get(i).getIDProduto()); 
                odb.setQtdOs(itensOrcamentos.get(i).getQtdOrcamento());
                odc.cadastrarItem(odb);
                
                
            }
            
           
            
       for(int w = 0; w < itensOrcamentos.size(); w++){
           
           
           pb.setCodProduto(itensOrcamentos.get(w).getIDProduto());
           pb.setQtdEstoque(itensOrcamentos.get(w).getQtdOrcamento());
           pc.retirarQtdEstoque(pb);
           //produt.add(pb);
           
           }
        
       
       
       }
       
          
            
        
        
        
        
    
    
    
    
    
    public void aprovarOrcamento(){
        OrcamentosBean ob =new OrcamentosBean();
        OrcamentosControl oc = new OrcamentosControl();
        codorcamento = orcamentospendentes.get(tbOrcamentosPendentes.getSelectedRow()).getCodOrcamento();
        if(codorcamento != null && codstatus != null){
            ob.setCodOrcamento(codorcamento);
            ob.setIDStatus(codstatus);
            oc.alterarStatus(ob);
            JOptionPane.showMessageDialog(this, "Status do Orçamento foi alterado");
            criarOS();
            excluirOrcamentoDet();
            oc.excluirOrcamento(codorcamento);
            
            tbOrcamentosPendentes.getSelectionModel().clearSelection();
            //fechar();
            ftfDataVencimento.requestFocus();
            ftfDataVencimento.setSelectableDateRange(null, null);
                   
        }else{
            JOptionPane.showMessageDialog(this, "Erro ao mudar Status do Orçamento");
        }
        
        btAprovar.setEnabled(false);
        btReprovar.setEnabled(false);
        btAguardando.setEnabled(false);
        
    }
    
    
    
    protected void tbOrcamentosPendentesLinhaSelecionada(JTable tb){             //Ao selecionar um item na tabela, os dados serão preenchidos nos campos
        
        OrcamentosControl oc = new OrcamentosControl();
        btAprovar.setEnabled(true);
        btReprovar.setEnabled(true);
        btAguardando.setEnabled(true);
        btcomprovante.setEnabled(true);
        //codorcamento = null;
        //dat= null;
        
        
      SimpleDateFormat formato = new SimpleDateFormat("dd / MM / yyyy");
         /*   Date compararvencimento = new Date(System.currentTimeMillis());
            int dt;
            Date dtcomp;
        dtcomp = orcamentospendentes.get(tb.getSelectedRow()).getDataValidade();
        if(compararvencimento.after(dtcomp)){
            dt = 1;
        }
        else{
            dt = 2;
        }
        switch(dt){
            case 1: lblDtVencimento.setForeground(Color.red);
            case 2: lblDtVencimento.setForeground(Color.BLACK);
                
        
    }*/
        
    
              //      lblDtVencimento.setForeground(Color.red);
        
      //      }else{
        //lblDtVencimento.setForeground(Color.BLACK);
          //  }
        
       if (tb.getSelectedRow() != -1){
            
             
            
            btExcluirVenda.setEnabled(true);
            
            dat = orcamentospendentes.get(tb.getSelectedRow()).getDataValidade();
            
            lblCod.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getCodOrcamento()));
            lblClient.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getNomeCli()));
            lblFunc.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getNomeFunc()));
            lblForm.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getFormapgto()));
            lblCond.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getCondpgto()));
            //cbStatus1.setSelectedIndex(orcamentospendentes.get(tb.getSelectedRow()).getIDStatus());
            lblStatus.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getStatusOrcamento()));
            lblTelefone.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getTelefone()));
            lblCelular.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getCelular()));
            lblOperadora.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getOperadora()));
            lblServTerceiro.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getServicoTerceiro()));
            lblMo.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getMaoObra()));
            lblSubt.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getSubTotal()));            
            lblDescont.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getDesconto()));
            lblTot.setText(String.valueOf(orcamentospendentes.get(tb.getSelectedRow()).getTotal()));
            Date ddd;
            ddd = orcamentospendentes.get(tb.getSelectedRow()).getDataOrcamento();
            
            java.util.Date d = ddd;
            String dd;
            dd = String.valueOf(formato.format(d));
            lblDataConsulta.setText(dd);
            
            Date dv;
            String ddv = "";
            dv= orcamentospendentes.get(tb.getSelectedRow()).getDataValidade();
            ddv = String.valueOf(formato.format(dv));
            lblDtVencimento.setText(ddv);
            //codproduto = vendasfinalizadas.get(tb.getSelectedRow()).getIDProduto();
            //qtd = vendasfinalizadas.get(tb.getSelectedRow()).getQtd();
           
            
            
            
            while (tmItens.getRowCount() > 0){
                tmItens.removeRow(0);
            }
            
            codorcamento = orcamentospendentes.get(tb.getSelectedRow()).getCodOrcamento();
            OrcamentosControl vc = new OrcamentosControl();
            itensOrcamentos = vc.listarItens(codorcamento);
            String [] camposItens = new String[] {null, null, null, null, null};
            for(int t = 0; t < itensOrcamentos.size(); t++){
            
            tmItens.addRow(camposItens);
            tmItens.setValueAt(itensOrcamentos.get(t).getIDProduto(), t, 0);
            tmItens.setValueAt(itensOrcamentos.get(t).getDescricaoproduto(), t, 1);
            tmItens.setValueAt(itensOrcamentos.get(t).getMarca(), t, 2);
            tmItens.setValueAt(itensOrcamentos.get(t).getPreco(), t, 3);
            tmItens.setValueAt(itensOrcamentos.get(t).getQtdOrcamento(), t, 4);
            
            
        } 
          
       
       
       
        } else {
            
        
        
       }
          VerificarData vd = new VerificarData();
         if (vd.verificarData(dat)){
            lblDtVencimento.setForeground(Color.red);
            //JOptionPane.showMessageDialog(null, "Orçamento expirou a data de validade!", "Erro", JOptionPane.ERROR_MESSAGE); 
        }else{
            lblDtVencimento.setForeground(Color.black);
        }
       
        
    }
    
    private void comprovanteOrcamento(){
         try{
            Connection con = new AcessoMySql().conectar();
            HashMap parametros = new HashMap();
            ImageIcon gto = new ImageIcon(getClass().getResource("/Icons/CompetenteOS.jpg"));
             parametros.put("logo", gto.getImage());
            
            parametros.put("ID_ORCAMENTO", codorcamento );
            
            JasperPrint jp = JasperFillManager.fillReport("./jasper/ComprovanteOrcamento.jasper",parametros, con);
            //JasperPrint jp = JasperFillManager.fillReport("/Outros/Comprovante.jasper",parametros, con);
            
            JasperViewer jrv= new JasperViewer(jp, false); // implementando o "FALSE" Impede que a aplicação seja encerrada ao fechar o relatório
           
            jrv.setVisible(true);
            
        }catch(Exception e){
            JOptionPane.showMessageDialog(this, "TEste");
        }
    }
    
    
    protected void fechar(){
       // cbProdutos.setEnabled(false);
            mo = 0;
            subtotal = 0;
            total = 0;
            servicoterceiro = 0;
            tfProduto.setText("");
        /*    orcamentospendentes.clear();
            orcamentos.clear();
            produt.clear();*/
            
           
        
        ftfQuantidade.setValue(1);
        tbOrcamentos.removeAll();
while (orcamentos.size()>0){
            orcamentos.remove(0);            
        }

while (orcamentosdet.size()>0){
            orcamentosdet.remove(0);            
        }
while (orcamentospendentes.size()>0){
            orcamentospendentes.remove(0);            
        }
while (produt.size()>0){
            produt.remove(0);           
        }
while (tmOrcamentos.getRowCount()>0){
            tmOrcamentos.removeRow(0); 
            
        }

while (tmOrcamentosPendentes.getRowCount() > 0){
                tmOrcamentosPendentes.removeRow(0);
            }
while (tmItens.getRowCount() > 0){
                tmItens.removeRow(0);
            }

//dataIni.setDate(null);
//dataFim.setDate(null);

    
    }
    
    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        abaCadastrar = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbOrcamentos = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbVendas1 = new javax.swing.JTable();
        Cabecalho = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        lblCodigo = new javax.swing.JLabel();
        lblClientes = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        cbClientes = new javax.swing.JComboBox();
        lblData = new javax.swing.JLabel();
        ftfDataVencimento = new com.toedter.calendar.JDateChooser();
        jLabel8 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        cbStatus = new javax.swing.JComboBox();
        jPanel5 = new javax.swing.JPanel();
        tfProduto = new javax.swing.JTextField();
        btInserir = new javax.swing.JButton();
        btExcluir = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        ftfQuantidade = new JFormattedTextField(NumberFormat.getNumberInstance());
        jLabel2 = new javax.swing.JLabel();
        rodape = new javax.swing.JPanel();
        lbltotal = new javax.swing.JLabel();
        lblDesconto = new javax.swing.JLabel();
        lblSubtotal = new javax.swing.JLabel();
        ftfSubtotal = new JFormattedTextField(NumberFormat.getNumberInstance());
        ftfDesconto = new JFormattedTextField(NumberFormat.getNumberInstance());
        ftfTotal = new JFormattedTextField(NumberFormat.getNumberInstance());
        cbConds = new javax.swing.JComboBox();
        cbFormas = new javax.swing.JComboBox();
        lblForma = new javax.swing.JLabel();
        lblConds = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        ftfServicoTerceiros = new JFormattedTextField(NumberFormat.getNumberInstance());
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        ftfMO = new JFormattedTextField(NumberFormat.getNumberInstance());
        tfObs = new javax.swing.JTextField();
        Botoes = new javax.swing.JPanel();
        btNovo = new javax.swing.JButton();
        btFinalizar = new javax.swing.JButton();
        btCancelar = new javax.swing.JButton();
        abaConsulatar = new javax.swing.JPanel();
        lblCod = new javax.swing.JLabel();
        lblClient = new javax.swing.JLabel();
        lblFunc = new javax.swing.JLabel();
        lblForm = new javax.swing.JLabel();
        lblCond = new javax.swing.JLabel();
        lblSubt = new javax.swing.JLabel();
        lblDescont = new javax.swing.JLabel();
        lblTot = new javax.swing.JLabel();
        btPesq = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        btExcluirVenda = new javax.swing.JButton();
        dataFim = new com.toedter.calendar.JDateChooser();
        dataIni = new com.toedter.calendar.JDateChooser();
        lblDataConsulta = new javax.swing.JLabel();
        lblStatus = new javax.swing.JLabel();
        lblDtVencimento = new javax.swing.JLabel();
        lblTelefone = new javax.swing.JLabel();
        lblCelular = new javax.swing.JLabel();
        lblOperadora = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbItens = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tbOrcamentosPendentes = new javax.swing.JTable();
        lblServTerceiro = new javax.swing.JLabel();
        lblMo = new javax.swing.JLabel();
        btAprovar = new javax.swing.JButton();
        btReprovar = new javax.swing.JButton();
        btAguardando = new javax.swing.JButton();
        btcomprovante = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("VENDAS");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                teste(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                fecharForm(evt);
            }
        });

        jTabbedPane1.setToolTipText("");
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(800, 720));

        tbOrcamentos.setModel(tmOrcamentos);
        tbOrcamentos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        lsmOrcamentos = tbOrcamentos.getSelectionModel();
        lsmOrcamentos.addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                if(! e.getValueIsAdjusting()){
                    tbVendasLinhaSelecionada(tbOrcamentos);
                }
            }
        });
        jScrollPane1.setViewportView(tbOrcamentos);

        tbVendas1.setModel(tmOrcamentos);
        tbOrcamentos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        lsmOrcamentos = tbOrcamentos.getSelectionModel();
        lsmOrcamentos.addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                if(! e.getValueIsAdjusting()){
                    tbVendasLinhaSelecionada(tbOrcamentos);
                }
            }
        });
        jScrollPane2.setViewportView(tbVendas1);

        jLabel1.setText("Codigo");

        lblCodigo.setToolTipText("");

        lblClientes.setText("Cliente");

        jLabel5.setText("Data");

        cbClientes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbClientes.setSelectedIndex(-1);
        cbClientes.setEnabled(false);

        ftfDataVencimento.setEnabled(false);

        jLabel8.setText("Orçamento válido até");

        jLabel13.setText("Status");

        cbStatus.setToolTipText("");
        cbStatus.setEnabled(false);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Inserção e Remoção de Itens", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        tfProduto.setEnabled(false);

        btInserir.setText("Inserir");
        btInserir.setToolTipText("");
        btInserir.setEnabled(false);
        btInserir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btInserirActionPerformed(evt);
            }
        });

        btExcluir.setText("Excluir Item");
        btExcluir.setEnabled(false);
        btExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExcluirActionPerformed(evt);
            }
        });

        jLabel11.setText("QTD");

        ftfQuantidade.setEnabled(false);

        jLabel2.setText("Código ou Descrição do Produto");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(btInserir, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(181, 181, 181)
                        .addComponent(btExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(tfProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel11)
                        .addGap(18, 18, 18)
                        .addComponent(ftfQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2))
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tfProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(ftfQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)))
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(btExcluir))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btInserir))))
        );

        javax.swing.GroupLayout CabecalhoLayout = new javax.swing.GroupLayout(Cabecalho);
        Cabecalho.setLayout(CabecalhoLayout);
        CabecalhoLayout.setHorizontalGroup(
            CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CabecalhoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CabecalhoLayout.createSequentialGroup()
                        .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(CabecalhoLayout.createSequentialGroup()
                                .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblClientes, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel13))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cbClientes, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cbStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(CabecalhoLayout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(ftfDataVencimento, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(128, 128, 128)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 381, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblData, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(CabecalhoLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        CabecalhoLayout.setVerticalGroup(
            CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CabecalhoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(lblCodigo))
                    .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(lblData, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(cbStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(CabecalhoLayout.createSequentialGroup()
                        .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblClientes)
                            .addComponent(cbClientes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(CabecalhoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(ftfDataVencimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        CabecalhoLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel1, lblCodigo});

        CabecalhoLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel5, lblData});

        lbltotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lbltotal.setText("Total");

        lblDesconto.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblDesconto.setText("Desconto");

        lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblSubtotal.setText("Subtotal");

        ftfSubtotal.setEnabled(false);

        ftfDesconto.setEnabled(false);

        ftfTotal.setEnabled(false);
        ftfTotal.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                total(evt);
            }
        });

        cbConds.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbConds.setSelectedIndex(-1);
        cbConds.setEnabled(false);

        cbFormas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbFormas.setSelectedIndex(-1);
        cbFormas.setEnabled(false);

        lblForma.setText("Forma de Pagamento");

        lblConds.setText("Condição de Pagamento");

        jLabel9.setText("Serviços de Terceiros");

        ftfServicoTerceiros.setEnabled(false);

        jLabel10.setText("OBS.:");

        jLabel12.setText("Mão de Obra");

        ftfMO.setEnabled(false);

        tfObs.setEnabled(false);

        javax.swing.GroupLayout rodapeLayout = new javax.swing.GroupLayout(rodape);
        rodape.setLayout(rodapeLayout);
        rodapeLayout.setHorizontalGroup(
            rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(rodapeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(rodapeLayout.createSequentialGroup()
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblConds, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                            .addComponent(lblForma, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbConds, 0, 131, Short.MAX_VALUE)
                            .addComponent(cbFormas, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(93, 93, 93)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblSubtotal)
                            .addComponent(jLabel12))
                        .addGap(18, 18, 18)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(ftfMO)
                            .addComponent(ftfSubtotal, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rodapeLayout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfObs)))
                .addGap(18, 18, 18)
                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblDesconto, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbltotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(ftfServicoTerceiros)
                    .addComponent(ftfDesconto)
                    .addComponent(ftfTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        rodapeLayout.setVerticalGroup(
            rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rodapeLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(rodapeLayout.createSequentialGroup()
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(ftfServicoTerceiros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ftfDesconto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(rodapeLayout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addComponent(lblDesconto, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ftfTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbltotal, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(rodapeLayout.createSequentialGroup()
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(rodapeLayout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblForma, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(cbFormas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(6, 6, 6))
                            .addGroup(rodapeLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(lblSubtotal))
                            .addComponent(ftfSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(rodapeLayout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblConds)
                                    .addComponent(cbConds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel12)
                                .addComponent(ftfMO, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(rodapeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(tfObs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(10, 10, 10))
        );

        btNovo.setText("Novo Orçarmento");
        btNovo.setActionCommand("Novo Orcarmento");
        btNovo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btNovoActionPerformed(evt);
            }
        });

        btFinalizar.setText("Registrar Orçamento");
        btFinalizar.setToolTipText("");
        btFinalizar.setActionCommand("Registrar Orcamento");
        btFinalizar.setEnabled(false);
        btFinalizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btFinalizarActionPerformed(evt);
            }
        });

        btCancelar.setText("Cancelar Orçamento");
        btCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout BotoesLayout = new javax.swing.GroupLayout(Botoes);
        Botoes.setLayout(BotoesLayout);
        BotoesLayout.setHorizontalGroup(
            BotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(BotoesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btNovo)
                .addGap(18, 18, 18)
                .addComponent(btFinalizar)
                .addGap(18, 18, 18)
                .addComponent(btCancelar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        BotoesLayout.setVerticalGroup(
            BotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(BotoesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(BotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btNovo)
                    .addComponent(btFinalizar)
                    .addComponent(btCancelar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout abaCadastrarLayout = new javax.swing.GroupLayout(abaCadastrar);
        abaCadastrar.setLayout(abaCadastrarLayout);
        abaCadastrarLayout.setHorizontalGroup(
            abaCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abaCadastrarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(abaCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Cabecalho, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1)
                    .addGroup(abaCadastrarLayout.createSequentialGroup()
                        .addComponent(rodape, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                        .addComponent(Botoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23)))
                .addContainerGap())
        );
        abaCadastrarLayout.setVerticalGroup(
            abaCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abaCadastrarLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Cabecalho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(abaCadastrarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, abaCadastrarLayout.createSequentialGroup()
                        .addComponent(rodape, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, abaCadastrarLayout.createSequentialGroup()
                        .addComponent(Botoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(39, 39, 39))))
        );

        jTabbedPane1.addTab("Cadastrar", abaCadastrar);

        abaConsulatar.setMinimumSize(new java.awt.Dimension(1291, 650));
        abaConsulatar.setPreferredSize(new java.awt.Dimension(1291, 650));

        lblCod.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Codigo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblClient.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cliente", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblFunc.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Funcionario", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblForm.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Forma PGTO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblCond.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Condição PGTO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblSubt.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Subtotal", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblDescont.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Desconto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblTot.setToolTipText("");
        lblTot.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Total", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        btPesq.setText("Pesquisar");
        btPesq.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btPesqActionPerformed(evt);
            }
        });

        jLabel4.setText("Data Final");

        jLabel6.setText("Data Inicial");

        btExcluirVenda.setText("Excluir");
        btExcluirVenda.setEnabled(false);
        btExcluirVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExcluirVendaActionPerformed(evt);
            }
        });

        lblDataConsulta.setBorder(javax.swing.BorderFactory.createTitledBorder("Data do Orçamento"));

        lblStatus.setForeground(new java.awt.Color(0, 0, 255));
        lblStatus.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblDtVencimento.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data de Validade", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblTelefone.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Telefone", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblCelular.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Celular", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblOperadora.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Operadora", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ITENS DO ORÇAMENTO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        tbItens.setModel(tmItens);
        jScrollPane3.setViewportView(tbItens);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ORÇAMENTOS", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        tbOrcamentosPendentes.setModel(tmOrcamentosPendentes);
        tbOrcamentosPendentes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        lsmOrcamentosPendentes = tbOrcamentosPendentes.getSelectionModel();
        lsmOrcamentosPendentes.addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                if(! e.getValueIsAdjusting()){
                    tbOrcamentosPendentesLinhaSelecionada(tbOrcamentosPendentes);
                }
            }
        });
        jScrollPane4.setViewportView(tbOrcamentosPendentes);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1249, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        lblServTerceiro.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serviço de Terceiros", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        lblMo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Mão de Obra", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        btAprovar.setText("Aprovar Orçamento");
        btAprovar.setEnabled(false);
        btAprovar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAprovarActionPerformed(evt);
            }
        });

        btReprovar.setText("Cancelar Orçamento");
        btReprovar.setToolTipText("");
        btReprovar.setEnabled(false);
        btReprovar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btReprovarActionPerformed(evt);
            }
        });

        btAguardando.setText("Aguardando Aprovação");
        btAguardando.setEnabled(false);
        btAguardando.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAguardandoActionPerformed(evt);
            }
        });

        btcomprovante.setText("Gerar Comprovante");
        btcomprovante.setEnabled(false);
        btcomprovante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btcomprovanteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout abaConsulatarLayout = new javax.swing.GroupLayout(abaConsulatar);
        abaConsulatar.setLayout(abaConsulatarLayout);
        abaConsulatarLayout.setHorizontalGroup(
            abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abaConsulatarLayout.createSequentialGroup()
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(abaConsulatarLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(abaConsulatarLayout.createSequentialGroup()
                                .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(lblDataConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(lblDtVencimento, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lblCod, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, abaConsulatarLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(dataIni, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(dataFim, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btPesq)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btExcluirVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btcomprovante)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btAguardando)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btAprovar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btReprovar))
                            .addGroup(abaConsulatarLayout.createSequentialGroup()
                                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(abaConsulatarLayout.createSequentialGroup()
                                        .addComponent(lblClient, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblFunc, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(abaConsulatarLayout.createSequentialGroup()
                                        .addGap(286, 286, 286)
                                        .addComponent(lblTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblOperadora, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(abaConsulatarLayout.createSequentialGroup()
                                        .addComponent(lblForm, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblCond, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblSubt, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblServTerceiro, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblMo, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblDescont, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(lblTot, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE)))))
                .addContainerGap())
        );

        abaConsulatarLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btExcluirVenda, btPesq});

        abaConsulatarLayout.setVerticalGroup(
            abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abaConsulatarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblDataConsulta, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblDtVencimento, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(lblCod, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblFunc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblClient, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblTelefone)
                    .addComponent(lblCelular)
                    .addComponent(lblOperadora))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblForm, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblCond, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblSubt)
                    .addComponent(lblServTerceiro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblMo)
                    .addComponent(lblDescont)
                    .addComponent(lblTot))
                .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btAprovar)
                        .addComponent(btReprovar)
                        .addComponent(btAguardando))
                    .addGroup(abaConsulatarLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel6)
                            .addComponent(dataIni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)
                            .addComponent(dataFim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(abaConsulatarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btPesq)
                        .addComponent(btExcluirVenda)
                        .addComponent(btcomprovante)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(66, Short.MAX_VALUE))
        );

        abaConsulatarLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btAguardando, btAprovar, btReprovar, lblCelular, lblClient, lblCond, lblDescont, lblForm, lblMo, lblOperadora, lblServTerceiro, lblSubt, lblTelefone, lblTot});

        jTabbedPane1.addTab("Consultar", abaConsulatar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1296, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 639, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.getAccessibleContext().setAccessibleName("");

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btInserirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btInserirActionPerformed
        incluirProduto();
        
        
    }//GEN-LAST:event_btInserirActionPerformed

    private void btNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNovoActionPerformed
        novoCadastro();
        
    }//GEN-LAST:event_btNovoActionPerformed

    private void btFinalizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btFinalizarActionPerformed
        cadastrarOrcamento();
        //fechar();
       
    }//GEN-LAST:event_btFinalizarActionPerformed

    private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed
        removerProduto();
    }//GEN-LAST:event_btExcluirActionPerformed

    private void fecharForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_fecharForm
        tbOrcamentosPendentes.getSelectionModel().clearSelection();
         tbOrcamentos.getSelectionModel().clearSelection();
        fechar();

    }//GEN-LAST:event_fecharForm

    private void btCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelarActionPerformed
        ftfSubtotal.setValue(0);
        ftfDesconto.setValue(0);
        ftfTotal.setValue(0);
        ftfServicoTerceiros.setValue(0);
        tfProduto.setText("");
        desabilitarCampos();
        fechar();
    }//GEN-LAST:event_btCancelarActionPerformed

    private void btPesqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btPesqActionPerformed
        
        pesquisarOrcamentos();
        btExcluir.setEnabled(true);
        
    }//GEN-LAST:event_btPesqActionPerformed

    private void btExcluirVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirVendaActionPerformed
       excluirOrcamentoDet();
        excluirOrcamento();
    }//GEN-LAST:event_btExcluirVendaActionPerformed

    private void teste(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_teste

    }//GEN-LAST:event_teste

    private void total(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_total
        mo = Double.parseDouble(String.valueOf(ftfMO.getValue()));
        servicoterceiro = Double.parseDouble(String.valueOf(ftfServicoTerceiros.getValue()));
        desconto = Double.parseDouble(String.valueOf(ftfDesconto.getValue()));
            total = (subtotal - desconto) + servicoterceiro + mo;
            ftfTotal.setValue(total);
    }//GEN-LAST:event_total

    private void btAprovarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAprovarActionPerformed
        
        codstatus = 2;
        aprovarOrcamento();
        
        codstatus = null;
        codorcamento = null;
        pesquisarOrcamentos();
        
    }//GEN-LAST:event_btAprovarActionPerformed

    private void btReprovarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btReprovarActionPerformed
        codstatus = 3;
        aprovarOrcamento();
        codstatus = null;
        codorcamento = null;
        pesquisarOrcamentos();
    }//GEN-LAST:event_btReprovarActionPerformed

    private void btAguardandoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAguardandoActionPerformed
        codstatus = 1;
        aprovarOrcamento();
        codstatus = null;
        codorcamento = null;
        pesquisarOrcamentos();
    }//GEN-LAST:event_btAguardandoActionPerformed

    private void btcomprovanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcomprovanteActionPerformed
        comprovanteOrcamento();
    }//GEN-LAST:event_btcomprovanteActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Orcamentos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Orcamentos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Orcamentos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Orcamentos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new Orcamentos().setVisible(true);
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(Orcamentos.class.getName()).log(Level.SEVERE, null, ex);
                } catch (InstantiationException ex) {
                    Logger.getLogger(Orcamentos.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(Orcamentos.class.getName()).log(Level.SEVERE, null, ex);
                } catch (UnsupportedLookAndFeelException ex) {
                    Logger.getLogger(Orcamentos.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Botoes;
    private javax.swing.JPanel Cabecalho;
    private javax.swing.JPanel abaCadastrar;
    private javax.swing.JPanel abaConsulatar;
    private javax.swing.JButton btAguardando;
    private javax.swing.JButton btAprovar;
    public javax.swing.JButton btCancelar;
    public javax.swing.JButton btExcluir;
    public javax.swing.JButton btExcluirVenda;
    public javax.swing.JButton btFinalizar;
    public javax.swing.JButton btInserir;
    public javax.swing.JButton btNovo;
    public javax.swing.JButton btPesq;
    private javax.swing.JButton btReprovar;
    private javax.swing.JButton btcomprovante;
    public javax.swing.JComboBox cbClientes;
    public javax.swing.JComboBox cbConds;
    public javax.swing.JComboBox cbFormas;
    private javax.swing.JComboBox cbStatus;
    public com.toedter.calendar.JDateChooser dataFim;
    public com.toedter.calendar.JDateChooser dataIni;
    private com.toedter.calendar.JDateChooser ftfDataVencimento;
    public javax.swing.JFormattedTextField ftfDesconto;
    private javax.swing.JFormattedTextField ftfMO;
    public javax.swing.JFormattedTextField ftfQuantidade;
    private javax.swing.JFormattedTextField ftfServicoTerceiros;
    public javax.swing.JFormattedTextField ftfSubtotal;
    public javax.swing.JFormattedTextField ftfTotal;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lblCelular;
    public javax.swing.JLabel lblClient;
    public javax.swing.JLabel lblClientes;
    public javax.swing.JLabel lblCod;
    public javax.swing.JLabel lblCodigo;
    public javax.swing.JLabel lblCond;
    public javax.swing.JLabel lblConds;
    private javax.swing.JLabel lblData;
    public javax.swing.JLabel lblDataConsulta;
    public javax.swing.JLabel lblDescont;
    public javax.swing.JLabel lblDesconto;
    public javax.swing.JLabel lblDtVencimento;
    public javax.swing.JLabel lblForm;
    public javax.swing.JLabel lblForma;
    public javax.swing.JLabel lblFunc;
    private javax.swing.JLabel lblMo;
    private javax.swing.JLabel lblOperadora;
    private javax.swing.JLabel lblServTerceiro;
    private javax.swing.JLabel lblStatus;
    public javax.swing.JLabel lblSubt;
    public javax.swing.JLabel lblSubtotal;
    private javax.swing.JLabel lblTelefone;
    public javax.swing.JLabel lblTot;
    public javax.swing.JLabel lbltotal;
    private javax.swing.JPanel rodape;
    public javax.swing.JTable tbItens;
    public javax.swing.JTable tbOrcamentos;
    public javax.swing.JTable tbOrcamentosPendentes;
    public javax.swing.JTable tbVendas1;
    private javax.swing.JTextField tfObs;
    private javax.swing.JTextField tfProduto;
    // End of variables declaration//GEN-END:variables
}
